package com.key.controller.admin.setting;

import com.key.common.R;
import com.key.common.vo.AssetFieldAndBusinessVO;
import com.key.entity.AssetField;

import com.key.entity.AssetTypeBusiness;
import com.key.entity.PArea;
import com.key.service.GeneralService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping("/general")
@Api(value = "通用设置",tags = "通用设置接口API")
public class GeneralController {
    @Autowired
    private GeneralService generalService;

    @RequestMapping(value = "/findCheckedAssetField",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "查询已选资产字段",notes = "查询资产字段表",httpMethod = "get", response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="成功"),
            @ApiResponse(code=401,message="token为空"),
            @ApiResponse(code=1005,message="Token过期"),
            @ApiResponse(code=1006,message="Token验证不通过"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R findCheckedAssetField(){
       return generalService.findCheckedAssetField();
    }

    @RequestMapping(value = "/findCheckedAssetType",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "查询资产分类权限",notes = "查询已选资产分类接口",httpMethod = "get", response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="成功"),
            @ApiResponse(code=401,message="token为空"),
            @ApiResponse(code=1005,message="Token过期"),
            @ApiResponse(code=1006,message="Token验证不通过"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R findCheckedAssetType(){

        return generalService.findCheckedAssetType();
    }

    @RequestMapping(value = "/commitService",method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "提交修改业务",notes = "提交修改后的员工权限",httpMethod = "post", response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="成功"),
            @ApiResponse(code=401,message="token为空"),
            @ApiResponse(code=1005,message="Token过期"),
            @ApiResponse(code=1006,message="Token验证不通过"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R commitService(@RequestBody @ApiParam(name = "assetFieldAndBusinessVO",value = "修改业务实体",required = true) AssetFieldAndBusinessVO assetFieldAndBusinessVO){

        return generalService.commitService(assetFieldAndBusinessVO);
    }

}
